package com.axisdesign.client;

import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class MainContentPanel extends VerticalPanel{
	final String featuredProjectLink = DOCstring.getWndVariable("featuredProject");
	
	AbsolutePanel topPanel;
	HorizontalPanel bottomPanel;
	AbsolutePanel featuredProjectPanel;
	PNGImage2 image1;
	FlipImage image2;
	FlipImage image3;
	FlipImage image4;
	PNGImage2 image5;
	PNGImage2 image6;
	PNGImage2 image7;
	
	public MainContentPanel() {
		topPanel = new AbsolutePanel();
		bottomPanel = new HorizontalPanel();
		featuredProjectPanel = new AbsolutePanel();
		
		image1 = new PNGImage2("images/mainFrame/content/mainContent/image1.png",297,291);
		image2 = new FlipImage(
			new PNGImage2("images/mainFrame/content/mainContent/image2_a.png",189,291)
			,new PNGImage2("images/mainFrame/content/mainContent/image2_b.png",189,291)
			,true
			);
		image3 = new FlipImage(
				new PNGImage2("images/mainFrame/content/mainContent/image3_a.png",189,291)
				,new PNGImage2("images/mainFrame/content/mainContent/image3_b.png",189,291)
				,true
				);
		image4 = new FlipImage(
				new PNGImage2("images/mainFrame/content/mainContent/image4_a.png",189,291)
				,new PNGImage2("images/mainFrame/content/mainContent/image4_b.png",189,291)
				,true
				);
		image5 = new PNGImage2("images/mainFrame/content/mainContent/image5.png",693,193);
		image6 = new PNGImage2("images/mainFrame/content/mainContent/image6.png",197,193);
		image7 = new PNGImage2("images/mainFrame/content/mainContent/image7.png",143,86);
		
		setStyleName("contentFrame-mainContentPanel");
		topPanel.setStyleName("contentFrame-mainContentPanel-topPanel");
		bottomPanel.setStyleName("contentFrame-mainContentPanel-bottomPanel");
		init();
	}
	
	private void init() {
		topPanel.add(image1,0,0);
		topPanel.add(image2,309,0);
		topPanel.add(image3,510,0);
		topPanel.add(image4,711,0);
		
		topPanel.setPixelSize(900, 291);
		
		bottomPanel.add(image5);
		bottomPanel.add(featuredProjectPanel);
		featuredProjectPanel.add(image6,0,0);
		featuredProjectPanel.add(image7,25,40);
		featuredProjectPanel.setPixelSize(197, 193);
		
		add(topPanel);
		add(bottomPanel);
		
		image2.addClickListener(new ClickListener() {public void onClick(Widget sender) {FrameManager.mainFrame.queue(0);}});
		image3.addClickListener(new ClickListener() {public void onClick(Widget sender) {FrameManager.mainFrame.queue(1);}});
		image4.addClickListener(new ClickListener() {public void onClick(Widget sender) {FrameManager.mainFrame.queue(2);}});
		image7.addClickListener(new ClickListener() {public void onClick(Widget sender) {HrefLink.gotoLink(featuredProjectLink);}});
	}
	
}
